package com.guigu.common.mapper;


import com.guigu.common.pojo.SGather;
import com.guigu.common.pojo.SGatherDetails;
import com.guigu.leizihao.vo.SGatherDetailsView;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface SGatherDetailsMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(SGatherDetails record);

    int insertSelective(SGatherDetails record);

    SGatherDetails selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(SGatherDetails record);

    int updateByPrimaryKey(SGatherDetails record);

    void addGatherDetail(List<SGatherDetails> list);

//    @Select("select * from s_gather_details where parent_id=#{value}")
    List<SGatherDetails> findGatherDetailsById(int id);

    @Update("update s_gather_details set gather_tag='k002-1' where parent_id=#{value} ")
    void changeSGatherToAudit(int id);

    @Update("update s_gather_details set gather_tag='k002-2' where id=#{value}")
    int UpdateGather_details(Integer id);

    void updateGather_detailsquantityInStorage(List<SGatherDetails> list);

    List<SGatherDetails> findGatherDetailsByIdandQuantityIinStorage(Integer id);


    void EnterbankCheckPass(List<SGatherDetails> list);

    @Select("SELECT SUM(g.cost_price*gathered_amount) FROM s_gather_details g WHERE parent_id=#{value}")
    Integer queryTotalcost(Integer id);

    Integer queryAmountById(Integer id);

    List<SGatherDetailsView> queryGatherDetailsByproductId(String productid);
}